package com.cictec.middleware.tde.rm.protocol.rm.decode;

import java.nio.ByteBuffer;

import org.apache.mina.core.session.IoSession;

import com.cictec.middleware.commons.utils.BinaryUtils;
import com.cictec.middleware.tde.exception.MessageDecoderException;
import com.cictec.middleware.tde.rm.protocol.AbstractMessageDecoder;
import com.cictec.middleware.tde.rm.protocol.TerminalMessage;
import com.cictec.middleware.tde.rm.protocol.TerminalMessage.Header;
import com.cictec.middleware.tde.rm.protocol.annotion.TerminalMessageDecoder;
import com.cictec.middleware.tde.rm.protocol.rm.message.Rm0x05TerminalMessage;

/**
 * 0x05 心跳连接指令
 * 
 * @author Administrator
 *
 */
@TerminalMessageDecoder(0x05)
public class Rm0x05Decoder extends AbstractMessageDecoder {

	@Override
	public TerminalMessage decode(Header header, ByteBuffer in, IoSession session) throws MessageDecoderException {

		Rm0x05TerminalMessage th = new Rm0x05TerminalMessage(header);
		th.setReserved(BinaryUtils.wordToInt(in));
		return th;
	}

}
